package com.itshizhan.demo1;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class java7 {
    public static void main(String[] args) {
        Date date = new Date();
        System.out.println(date);

        Calendar cal = Calendar.getInstance();
        //System.out.println(cal); // 获取Calendar实例


        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

        System.out.println(sdf.format(date));
        System.out.println(sdf.format(cal.getTime()));

    }
}
